package com.easyse.serviceparticaltasks.controller;

import com.easyse.model.DO.Group;
import com.easyse.model.vo.ResultVO;
import com.easyse.serviceparticaltasks.service.GroupService;


//import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：rc
 * @date ：Created in 2022/10/14 11:58
 * @description：实践任务
 *
 * */
@RestController
@RequestMapping(value = "/tasks/")

//@Api
public class GroupController {
    @Autowired
    GroupService groupService;

    //查询小组列表
    @GetMapping(value = "projects/teams/{classID}")
    public ResultVO joinTeam(@PathVariable("classID") Integer classID){
        return groupService.getGroupList(classID);
    }

    //加入小组
    @RequestMapping(value = "projects/teams/{teamCode}/{userID}",method = RequestMethod.PATCH)
    public ResultVO joinTeam(@PathVariable("teamCode") String teamCode,
                             @PathVariable("userID") Integer userID){

        //TODO 参数校验
        return groupService.joinGroup(teamCode,userID);
    }
    //退出小组/踢人
    @RequestMapping(value = "projects/teams/{userID}",method = RequestMethod.PATCH)
    public ResultVO quitTeam(@PathVariable("userID") Integer userID){

        //TODO 参数校验
        return groupService.quitGroup(userID);
    }

    //更新项目信息
    @RequestMapping(value = "projects/info",method = RequestMethod.PUT)
    public ResultVO updateProject(@RequestBody Group group){
        //TODO 参数校验
        return groupService.updateGroupInfo(group);
    }
    //查看项目详细信息
    @GetMapping(value = "projects/info/{goupID}")
    public ResultVO getProject(@PathVariable("goupID") Integer groupID){

        return groupService.getGroupInfo(groupID);
    }
    //总任务进度
    @GetMapping(value = "projects/progress/{goupID}")
    public ResultVO getProgress(@PathVariable("goupID") Integer groupID){

        return groupService.getProgress(groupID);
    }




    //

    /*


Y
项目详情信息
tasks/projects/missions/{projectid}
Y

Y
快结束的任务
tasks/projects/missions/info/{missionid}
Y
任务详情信息
tasks/projects/missions/info
Y
新增任务信息
tasks/classes/students/{class}
Y
某一班级下的学生列表
tasks/classes/teams/{team}
Y
班级下的小组列表
tasks/classes/students/{id}
Y
某一学生的任务信息
tasks/grades
Y
年级信息
tasks/grades/{year}
Y
查看某一年级下所有的班级

 */
}
